package com.zys.el.time.advice.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.util.Date;

import com.zys.el.time.service.redis.ScrollDetail;
import lombok.Data;

/**
 * 评论通知
 * @TableName comment_advice
 */
@TableName(value ="comment_advice")
@Data
public class CommentAdvice implements Serializable, ScrollDetail {
    /**
     * 通知id
     */
    @TableId
    private Long adviceId;

    /**
     * 发送者id
     */
    private Long fromUserId;

    /**
     * 评论id
     */
    private Long commentId;

    /**
     * 收信者id
     */
    private Long toUserId;

    /**
     * 通知类型(1：点赞；2：评论)
     */
    private Integer type;

    /**
     * 通知信息
     */
    private String msg;

    /**
     * 通知状态(1：未读；2：已读)
     */
    private Integer status;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 逻辑删除(1：删除；0：未删除)
     */
    @TableLogic
    private Integer isDelete;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public long getScore() {
        return this.getCreateTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
    }

    @Override
    public long getId() {
        return this.adviceId;
    }
}